package http

import (
	"net/http"

	"github.com/gin-gonic/gin"
	"github.com/liyaozong/mengo/common/di"
	"github.com/liyaozong/mengo/contracts/dtos/responses"
	"github.com/liyaozong/mengo/contracts/models"
)

type UserController struct {
	dic         *di.Container
	serviceName string
}

func NewUserController(dic *di.Container, serviceName string) *UserController {
	return &UserController{
		dic:         dic,
		serviceName: serviceName,
	}
}

func (u *UserController) UserInfo(ctx *gin.Context) {
	user := models.User{
		Name:     "yaozong",
		Username: "admin",
		Status:   1,
		Lang:     "zh-CN",
		RoleId:   "admin",
		Role: models.Role{
			Status: 1,
			Permissions: []models.Permission{
				{
					RoleId:         "admin",
					PermissionId:   "dashboard",
					PermissionName: "仪表盘",
					ActionEntitySet: []models.Action{
						{
							Name:         "query",
							Describe:     "查询",
							DefaultCheck: false,
						},
					},
				},
				{
					RoleId:         "admin",
					PermissionId:   "user",
					PermissionName: "用户",
					ActionEntitySet: []models.Action{
						{
							Name:         "query",
							Describe:     "查询",
							DefaultCheck: false,
						},
					},
				},
				{
					RoleId:         "admin",
					PermissionId:   "form",
					PermissionName: "用户",
					ActionEntitySet: []models.Action{
						{
							Name:         "query",
							Describe:     "查询",
							DefaultCheck: false,
						},
					},
				},
				{
					RoleId:         "admin",
					PermissionId:   "table",
					PermissionName: "用户",
					ActionEntitySet: []models.Action{
						{
							Name:         "query",
							Describe:     "查询",
							DefaultCheck: false,
						},
					},
				},
				{
					RoleId:         "admin",
					PermissionId:   "profile",
					PermissionName: "用户",
					ActionEntitySet: []models.Action{
						{
							Name:         "query",
							Describe:     "查询",
							DefaultCheck: false,
						},
					},
				},
				{
					RoleId:         "admin",
					PermissionId:   "support",
					PermissionName: "用户",
					ActionEntitySet: []models.Action{
						{
							Name:         "query",
							Describe:     "查询",
							DefaultCheck: false,
						},
					},
				},
				{
					RoleId:         "admin",
					PermissionId:   "exception",
					PermissionName: "用户",
					ActionEntitySet: []models.Action{
						{
							Name:         "query",
							Describe:     "查询",
							DefaultCheck: false,
						},
					},
				},
				{
					RoleId:         "admin",
					PermissionId:   "result",
					PermissionName: "用户",
					ActionEntitySet: []models.Action{
						{
							Name:         "query",
							Describe:     "查询",
							DefaultCheck: false,
						},
					},
				},
			},
		},
	}

	ctx.JSON(http.StatusOK, responses.NewUserResponse("", "成功", 0, user))
}
